<!DOCTYPE html>
<head>
<!--
dawnReader 
v0.2 独立web页面，可以接收绝对url作为参数
v0.3 防止报错
v0.4 第一行加粗
v0.5 美化移动端，和微信基本一致。
v0.6 解决url获取参数bug
v0.7 返回链接加到标题下，模仿微信；接收简化url(仅包含年月日)
v0.8 update year


-->
<meta http-equiv=Content-Type content="text/html;charset=utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no">

<script src="/static/js/tongji.js"></script>
<style>
*{margin:0; padding:0;}
.light,.grey{color:#ccc;}
.light{font-size:x-small;}
.btn{
	background: #55b9ff;
    color: white;
    padding: 0 5px;
	text-decoration: none;
}
.btn:hover{text-decoration: underline; background:#0096ff;}

.title{font-size:smaller;}
b.h1{font-size:x-large;}
.textDiv{
	margin:10px auto; 
	width:95%;
	max-width:600px;
	line-height: 1.3em;
}

#textPre{
	word-wrap: break-word!important; 
	white-space: pre-wrap;
	/*
	font-size: 17px;
	font-family: -apple-system-font,BlinkMacSystemFont,"Helvetica Neue","PingFang SC","Hiragino Sans GB","Microsoft YaHei UI","Microsoft YaHei",Arial,sans-serif;
	*/
	text-align: justify;
	
	font-family: Georgia, arial, Helvetica, sans-serif;
    font-weight: normal;
    font-size: 1.05em;
    line-height: 1.75;
    margin-bottom: 1.25em;
    text-rendering: optimizeLegibility;
}
#textPre img{max-width:100%;}

/*文中的引用部分：加粗，加大，左侧加灰色竖线。*/
#textPre b.center{
	border-left: 10px solid #ffc857;
    display: block;
    padding-left: 5px;
	margin:5px 0;
	font-size:larger;
}

#textPre a.blue{color:#576b95; text-decoration:none;
	font-size: 14px;
}


.footer{
	border-top:1px solid #ccc; 
	color:#ccc; 
	margin-top:50px; 
	margin:0;padding:10px 10px; 
	text-align:center;
}

.red{color:red;}

</style>
</head>


<body>
	<div id=reader>		
		<div class='textDiv'>
			<pre id='textPre'> Loading text now ...</pre>
		</div>
	</div>


	<div class=footer>
	&copy;2009-2025
	dawnReader. All rights reserved. | <a class=grey href='/reading/index2.html'>Home</a>
	</div>

</body>



<script>
//tools
var print=console.log
function $(s){
	return document.getElementById(s);
}

//获取url中的参数 https://www.cnblogs.com/vicky-li/p/9145026.html
function getUrlParam(name) {
	var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
	var r = window.location.search.substr(1).match(reg);  //匹配目标参数
	if (r != null) return unescape(r[2]); return null; //返回参数值
}


//最简单的ajax实例
window.onload=function(){
	
	//v1 传过来的是路径，v2传过来的是日期
	function openText(fileName){
		if( ! fileName.match('reading')){
			fileName='/reading/'+fileName+'.txt'
		}
		var xmlhttp=new XMLHttpRequest(); //1.获取对象
		//2.绑定回调函数
		xmlhttp.onreadystatechange=function(){
			if (xmlhttp.readyState==4 && xmlhttp.status==200){
				//$("fileName").innerHTML=fileName;
				//$("textPre").innerHTML=xmlhttp.responseText;
				//第一行加粗
				$("textPre").innerHTML=xmlhttp.responseText.replace(/^([^\n]+)\n/,function(x){
					//标题
					document.title=x+" - 英语读报";
					//第一行后面加返回链接，模仿微信
					var homeLink="<a class=blue href='/reading/index2.html'>英语读报</a> "
					return "<b class=h1>"+x+"</b>" + homeLink;
				});
			}
		}
		//3.设定访问的url
		xmlhttp.open("GET",fileName,true);
		//4.发送请求
		xmlhttp.send();
	}

	
	//获取url参数
	var date = getUrlParam('text');
	if(!date){
		//如果没有text参数，则alert提示，并给出返回按钮，然后返回。
		alert('No text parameter from url!')
		$("textPre").innerHTML="<a href=/reading/index2.html>Back</a>"
		location="/reading/index2.html";
		//
		return false;
	}else{
		openText(date)
	}
}


//"<script src='/wordKing/dawnDict.js'>< /script>"
console.log( "划词搜索, F12 console>>\n", 'var s=document.createElement("script");s.src="https://ielts.dawneve.cc/wordKing/dawnDict.js";document.body.append(s);')
</script>

<script>
var src="/track/dawnTrack.js?time="+new Date().getTime()
var oJS=document.createElement("script");
oJS.setAttribute("src", src)
document.getElementsByTagName("body")[0].appendChild(oJS);
</script>
</html>